import { request } from '@pkg/request/src';

export enum Api {
  page = '/server/page',
  serverList = '/server/list',
  get = '/server/get',
  add = '/server/save',
  update = '/server/update',
  remove = '/server/remove',
}

export const serverList = () => request.get({ url: Api.serverList }, { errorMessageMode: 'none', successMessageMode: 'none' });

export const get = (id: string) =>
  request.get(
    { url: Api.get, params: { id: id } },
    {
      errorMessageMode: 'none',
      successMessageMode: 'none',
    },
  );

export const add = (params) => request.post({ url: Api.add, params: params }, { errorMessageMode: 'none' });

export const update = (params) => request.post({ url: Api.update, params: params }, { errorMessageMode: 'none' });
